<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>

    <style>
        p{
            color: grey;
            font-family: "Arial",sans-serif;
            background-color: red;
        }
    </style>

</head>
<body>
    <p id="example" >An example of a paragraph</p>






    <script>

        // var paras = document.getElementsByTagName("p");
        // for(var i = 0; i < paras.length; i++) {
        //     paras[i].onclick = function() {
        //         alert("You clicked on a paragraph.")
        //     }
        // }
        var para = document.getElementById("example");
        para.onclick = function() {
            alert("The font family is " + para.style.backgroundColor)
        }
    </script>
</body>
</html>